/*
 * MMA7455.h
 *
 * Created: 01.05.2012 12:43:10
 *  Author: maxim.karban@gmail.com
 */ 


#ifndef MMA7455_H_
#define MMA7455_H_

#define MMA_DRPD  6
#define MMA_SPI3W 5
#define MMA_STON  4
#define MMA_GLVL1 3 
#define MMA_GLVL0 2
#define MMA_MODE1 1 
#define MMA_MODE0 0


#define MMA_MODE(a,b,c,d,e,f,g) \
  ( a << MMA_DRPD  | \
    b << MMA_SPI3W | \
    c << MMA_STON  | \
    d << MMA_GLVL1 | \
    e << MMA_GLVL0 | \
    f << MMA_MODE1 | \
    g << MMA_MODE0 )


//#define MMA_MODE_I2C PORTC |= 1 << PC0
//#define MMA_MODE_SPI PORTC &= ~(1 << PC0)

#define MMAInit() i2c_write(0x3A, 0x16, MMA_MODE(0, 0, 0, 0, 0, 0, 1))

#endif /* MMA7455_H_ */